home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: Do you have ever pass structures?
- Date: 25 Feb 1996 16:39:34 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4gqvg6INNfnf@keats.ugrad.cs.ubc.ca>
- References: <4ge8mi$qjm@srvr1.engin.umich.edu> <4ggsio$343@news-f.iadfw.net> <4gqk11$e7l@airdmhor.gen.nz>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <4gqk11$e7l@airdmhor.gen.nz>,
- Simon Hosie <gumboot@airdmhor.gen.nz> wrote:
- >Adam Peterson:
- >> The *disadvantage* is speed and space. Passing a pointer is just
- >> word//double word. Passing the actual structure requires loading the
- >> stack with all the elements of the structure...slow...
- >
- > But once it's done you don't have this pointer-thing to dereference all
- >the time (of course, this depends on how much register space you have - will
- >I ever get over my Intelesque hangups?).
-
- Yes you will have this "pointer thing to dereference". Because the argument
- will most likely be on your stack. And what is the stack if not another
- pointer?
-
- The elimination of apparent indirection of reference is not the motivation for
- passing structures by value. What it buys you is, in the case that you need to
- make a local copy of a structure, a way to do it invisibly in a syntactically
- succint manner. Same with passing structures as return values.
- --
-
-